package xyz.yuzegod.megawalls.game.stage;

import org.bukkit.Bukkit;
import org.bukkit.event.Event;
import org.bukkit.plugin.Plugin;
import xyz.yuzegod.megawalls.MegaWalls;
import xyz.yuzegod.megawalls.event.GameOverEvent;
import xyz.yuzegod.megawalls.game.Game;
import xyz.yuzegod.megawalls.timer.GameOverTimer;

public class BattleStage extends GameStage
{
    private int cacheLeft;
    
    public BattleStage() {
        super("距离游戏结束还有", 3000, 60, 3);
    }
    
    @Override
    public void excute(final Game game) {
        Bukkit.getPluginManager().callEvent((Event)new GameOverEvent(game));
        Bukkit.getScheduler().runTaskTimer((Plugin)MegaWalls.getInstance(), (Runnable)new GameOverTimer(game), 0L, 20L);
    }
    
    @Override
    public void excuteLeftSeconds(final Game game, final int left) {
        if (left == 60 || left == 30 || left <= 5) {
            game.broadcastMessage("§e你将在§c" + left + "§e秒后获得你的职业套装！");
        }
    }
    
    public int getCacheLeft() {
        return this.cacheLeft;
    }
    
    public void setCacheLeft(final int cacheLeft) {
        this.cacheLeft = cacheLeft;
    }
}
